<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Home</title>
<!-- Custom Theme files -->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>
<!-- Custom Theme files -->
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name="keywords" content="Login form web template, Sign up Web Templates, Flat Web Templates, Login signup Responsive web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<!--Google Fonts-->
<!--Google Fonts-->
<script src="js/jquery.js"></script>
<script type="text/javascript">
    $(function(){
    
   $("#userLogin").click(function(){
       var account=$("#username").val();
        var password=$("#password").val();
       var json={"account":account,"password":password,"identity":"user"}; 
       $.ajax({
           type:'post',
           url:"http://127.0.0.1:8080/login",
           // contentType:"application/json;chartset=utf-8",
           contentType: "application/x-www-form-urlencoded", //传过去的数据类型，此为表单
            data:json,
            dataType:'json',
             
         // dataType:"text",
           success:function(data){
               if(data.massage==1){
                window.location.href='http://127.0.0.1:8848/t/moban3932/User_book.html?account='+account;               
                }
                else
                alert("账号或密码错误，请重新输入");
           },
            error:function(){
                   alert("登陆失败,请重新操作");             
               }
       })
   });
   $("#adminLogin").click(function(){    
       var account=$("#username").val();
        var password=$("#password").val();
       var json={"account":account,"password":password,"identity":"admin"}; 
       $.ajax({
           type:'post',
           url:"http://127.0.0.1:8080/login",
           contentType:"application/x-www-form-urlencoded",
            data:json,
            dataType:'json',              
           success:function(data){
              console.log(data);
               if(data.massage==1){
                 window.location.href='http://127.0.0.1:8848/t/moban3932/table-basic.html';
                }
                else if(data.massage==0)
                alert("不存在该管理员"); 
           },
            error:function(){
                   alert("登陆失败,请重新操作"); 
               }
       })
   })
      }) 
    </script>
</head>
<body style="background-image: url(images/back3.jpeg);background-repeat: no-repeat;background-size: 1550px 757px;">
<div class="login">
	<h2 style="color: #000000; font-weight: bolder;">欢迎来到广西科技大学图书馆</h2>
	<div class="login-top">
		<h1>登陆</h1>
	
			<input type="text" id = "username"  placeholder="请输入账号" />
			<input type="password"  id = "password"placeholder="请输入密码" />
     
	    
	    <div class="forgot">    	
	    	<input type="button"  id="userLogin" value="登陆" ></input></br></br>
            <input type="button" id="adminLogin" value="管理员登陆" />
           
	    </div>
      
	</div>
	<div class="login-bottom">
		<h3>亲，如果你是新用户 请点击这&nbsp;<a href="注册.html">注册</a>哦</h3>
	</div>
</div>	
<div class="copyright">
	
</div>


</body>
</html>